import java.util.*;
public class Count{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
// 长字符串
        String strs = "";
// 对比的一个字符
        String find = "";
// 出现的次数
        int count = 0;
        while(scanner.hasNext()){
            strs = scanner.nextLine();
            find = scanner.nextLine();
            for(char s : strs.toCharArray()){
// 忽略大小写进行对比
                if(find.equalsIgnoreCase(String.valueOf(s))){
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}

